/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package rallyracer;

import com.google.common.collect.Lists;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import org.joda.time.DateTime;

/**
 *
 * @author samra_000
 */
public class RacerTest 
{
    public static void main(String[] args) throws DuplicateDataPointInSegmentException 
    {
        RacerTest t = new RacerTest();
        t.testSegment();
    }
    
    public void testRallyManager()
    {
        
    }
    
    public void testSegment() throws DuplicateDataPointInSegmentException
    {
        Segment s = new Segment(1);
        Random r = new Random();
        for( int i=0; i<100; i++)
        {
            DataPoint p2 = new DataPoint(Math.abs(r.nextInt()%100));
            
            if(p2.serialNumber%2!=0 && p2.serialNumber%3!=0)
            {
                p2.recommendedSpeed = p2.serialNumber;
            }
            if(s.getDataPointAt(p2.serialNumber)!=null)
            {
                continue;
            }
            s.add(p2);
        }
        
        
        List<DataPoint> points = s.getDataPoints();
        for(int i=0; i<points.size(); i++)
        {
            System.out.println("Serial# " + points.get(i).serialNumber);
        }
        System.out.println("Recommended speed at index 100 is " + s.getRecommendedSpeedAt(100));
        System.out.println("Recommended speed at index 90 is " + s.getRecommendedSpeedAt(90));
    }
}
